<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Rep\ExchangeGoodsRep;

class ExchangeGoods extends Controller
{
    //换货
    protected $rep;

    public function __construct(Request $request)
    {
        $this->rep = new ExchangeGoodsRep();
    }

    /**
     * 获取换货列表
     * product_name
     * color_id
     *
     */
    public function getExchangeGoodsList(Request $request){
        $params = $request->only(['customer_id','product_id','model_number_id','order_number','serial_number']);
        $data = $this->rep->getExchangeGoodsListRep($params);
        return re(0,$data,'success');
    }

    /**
     * 新增换货
     * @param Request $request
     * @return void
     */
    public function exchangeGoods(Request $request){
        $params = $request->only(['semi_id','remark','num','exchange_time']);
        $data = $this->rep->exchangeGoodsRep($params);
        return re(0,$data,'success');
    }

    /**
     * 获取换货详情
     * @param Request $request
     * @return void
     */
    public function getExchangeGoodsInfo(Request $request){
        $params = $request->only(['semi_id','remark','num','exchange_time']);
        $data = $this->rep->getExchangeGoodsInfoRep($params);
        return re(0,$data,'success');
    }
}
